package com.demo.mq.activemq.service;

import javax.jms.Topic;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Service;

/**
 * 消息生产者
 *
 * @author lee9213@163.com
 * @version 1.0
 * @date 2017/3/13 18:11
 */
@Service
public class MQProducerService {

    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

//    @Autowired
//    private Queue queue;

    @Autowired
    private Topic topic;

    public void send(String message){
//        this.jmsMessagingTemplate.convertAndSend(this.queue,message+":queue");
        this.jmsMessagingTemplate.convertAndSend(this.topic,message+":topic");
    }
}
